﻿using Contracts;
using Domain;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entities
{
    [Table("Orders")]
    public class OrderEntity : IEntity
    {
        public int Id { get; set; }

        [Required, Index(IsUnique=true)]
        public int OrderNumber { get; set; }

        public OrderStatus Status { get; set; }

        public int CustomerId { get; set; }

        [ForeignKey("CustomerId")]
        public virtual CustomerEntity Customer { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime CreatedOn { get; set; }

        public virtual ICollection<OrderItemEntity> Items { get; set; }

        [Required]
        public string TotalCurrency { get; set; }

        [DataType(DataType.Currency)]
        public decimal TotalAmount { get; set; }
    }
}
